// ignore_for_file: prefer_const_constructors_in_immutables, non_constant_identifier_names

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:verse_systems/res/colors.dart';
import 'package:verse_systems/utils/image_utils.dart';

class CustomizeMienAppbar extends StatelessWidget {
  final String? phone;
  final String? real_name;
  final String? credit_score;
  final String? quota;
  final String? rate;
  final VoidCallback logout;
  final VoidCallback contact;
  final VoidCallback onTapVip;
  CustomizeMienAppbar(
      {super.key,
      this.phone = "",
      this.real_name = "",
      this.credit_score = "0",
      this.quota = "0",
      this.rate = "0",
      required this.onTapVip,
      required this.logout,
      required this.contact});

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: 286.w,
      child: Stack(
        children: [
          Container(
            height: 248.w,
            width: MediaQuery.of(context).size.width,
            decoration: BoxDecoration(
              image: DecorationImage(
                  image:
                      ExactAssetImage(ImageUtils.getImgPath("mine_background")),
                  fit: BoxFit.fill),
            ),
            child: Container(
              margin: EdgeInsets.fromLTRB(19.w, 63.w, 19.w, 0),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Row(
                    children: [
                      Image.asset(
                        ImageUtils.getImgPath("head"),
                        fit: BoxFit.fill,
                        width: 66.w,
                        height: 66.w,
                      ),
                      SizedBox(width: 10.w),
                      Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        mainAxisSize: MainAxisSize.min,
                        children: [
                          Text(
                            phone.toString(),
                            style: TextStyle(
                                fontSize: 25.sp,
                                color: Colours.app_main_color,
                                fontWeight: FontWeight.w600),
                          ),
                          Container(
                            margin: EdgeInsets.only(top: 5.w),
                            padding: EdgeInsets.symmetric(
                                horizontal: 20.w, vertical: 3.w),
                            decoration: BoxDecoration(
                                color: Colours.stringAnAlphaColor("0xFFFFFFFF",
                                    alpha: 0.25),
                                borderRadius:
                                    BorderRadius.all(Radius.circular(15.w))),
                            child: Text(
                              real_name == "" ? "***" : real_name.toString(),
                              style: TextStyle(
                                  fontSize: 14.sp,
                                  color: Colours.app_main_color,
                                  fontWeight: FontWeight.w600),
                            ),
                          )
                        ],
                      ),
                    ],
                  ),
                  Row(
                    children: [
                      InkWell(
                          onTap: contact,
                          child: Container(
                              margin: EdgeInsets.only(top: 5.w),
                              child: Column(
                                mainAxisSize: MainAxisSize.min,
                                children: [
                                  Image.asset(
                                    ImageUtils.getImgPath("servers"),
                                    fit: BoxFit.fill,
                                    width: 20.w,
                                    height: 20.w,
                                  ),
                                  SizedBox(height: 20.w),
                                  Text(
                                    "contact_services".tr,
                                    style: TextStyle(
                                      fontSize: 10.sp,
                                      color: Colours.app_main_color,
                                    ),
                                  ),
                                ],
                              ))),
                      SizedBox(width: 10.w),
                      InkWell(
                          onTap: logout,
                          child: Container(
                              margin: EdgeInsets.only(top: 5.w),
                              child: Column(
                                mainAxisSize: MainAxisSize.min,
                                children: [
                                  Image.asset(
                                    ImageUtils.getImgPath("logo_out"),
                                    fit: BoxFit.fill,
                                    width: 20.w,
                                    height: 20.w,
                                  ),
                                  SizedBox(height: 20.w),
                                  Text(
                                    "sign_out".tr,
                                    style: TextStyle(
                                      fontSize: 10.sp,
                                      color: Colours.app_main_color,
                                    ),
                                  ),
                                ],
                              ))),
                    ],
                  )
                ],
              ),
            ),
          ),
          Positioned(
            top: 163.w,
            child: InkWell(
                onTap: onTapVip,
                child: Container(
                  padding: EdgeInsets.fromLTRB(20.w, 14.w, 6.w, 8.w),
                  margin: EdgeInsets.symmetric(
                      horizontal:
                          (MediaQuery.of(context).size.width - 330.w) / 2),
                  width: 330.w,
                  height: 123.w,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(10.w)),
                    image: DecorationImage(
                        image: ExactAssetImage(
                            ImageUtils.getImgPath("mine_vip_card")),
                        fit: BoxFit.fill),
                  ),
                  child: Column(
                    children: [
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            "membership_card".tr,
                            style: TextStyle(
                                fontSize: 18.sp,
                                color: Colours.app_msg_text_color,
                                fontWeight: FontWeight.w600),
                          ),
                          Container(
                            // margin: EdgeInsets.only(top: 5.w),
                            padding: EdgeInsets.symmetric(
                                horizontal: 20.w, vertical: 3.w),
                            decoration: BoxDecoration(
                                color: Colours.stringAnAlphaColor("0xFFFFFFFF",
                                    alpha: 0.25),
                                borderRadius:
                                    BorderRadius.all(Radius.circular(15.w))),
                            child: Text(
                              "hoist_score".tr,
                              style: TextStyle(
                                fontSize: 14.sp,
                                color: Colours.app_msg_text_color,
                              ),
                            ),
                          )
                        ],
                      ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Text(
                            "credit_score".tr,
                            style: TextStyle(
                              fontSize: 14.sp,
                              color: Colours.app_msg_text_color,
                            ),
                          ),
                          Text(
                            credit_score!.split(".")[0].toString(),
                            style: TextStyle(
                                fontSize: 42.sp,
                                color: Colours.app_msg_text_color,
                                fontWeight: FontWeight.w600),
                          ),
                          Text(
                            "分",
                            style: TextStyle(
                              fontSize: 14.sp,
                              color: Colours.app_msg_text_color,
                            ),
                          ),
                        ],
                      ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Text(
                            "${"highest".tr}:${quota.toString()}${"amount_quota".tr} · ${"fast_loan".tr} ·${rate.toString()}${"rate".tr} ",
                            style: TextStyle(
                              fontSize: 12.sp,
                              color: Colours.app_msg_text_color,
                            ),
                          ),
                        ],
                      )
                    ],
                  ),
                )),
          ),
        ],
      ),
    );
  }
}
